﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T12_OOP
{
    class Student
    {
        private string name;
        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        private int age;
        public int Age
        {
            get { return age; }
            set { if (value <= 0 | value > 100)
                    throw new ArgumentException("年龄参数异常");
                    age = value;
            }
        }
        public override string ToString()
        {
            //return base.ToString();
            return string.Format("{0}:{1}", name, age);
        }
    }
}
